
package com.gouaixin.bee.beeframework2.bean;


import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;


public class ADDRESS

{
//
//    // 收获地址
//    "ADDRESS" :
//    {
//        "! id"            : 15,
//            "name"            : "曲强",	 // 收件人姓名
//            "email"           : "77347042@qq.com",	 // 邮箱
//            "country"         : 1,	 // 国家
//            "province"        : 2,	 // 省
//            "city"            : 52,	 // 市
//            "district"        : 500,	 // 区
//            "address"         : "地址",	 // 地址
//            "zipcode"         : "",	 // 邮政编码
//            "tel"             : "12123123123",	 // 座机
//            "mobile"          : "",	 // 手机号
//            "sign_building"   : "标志建筑",	 // 标志建筑
//            "best_time"       : "",	 // 最佳时间
//            "default_address" : 1
//    },

    public int id;//ID


    public String name ;//姓名



    public String mobile; ;//电话


    public String province;


    public String city;//所在地区---市


    public String district;//所在地区---区




    public String address_desc ;//详细地址




    public String zipcode;//邮编

    public int default_address;//是否是默认地址，1表示是默认地址，0表示不是


    //------------------------------------------------



     public String sign_building;


     public String city_name;


     public String consignee;//姓名


     public String tel;




     public String country_name;


     public String country;


     public String province_name;


     public String district_name;


     public String email;


     public String address;


     public String best_time;



 public void fromJson(JSONObject jsonObject)  throws JSONException
 {
     if(null == jsonObject){
       return ;
      }


     JSONArray subItemArray;

     this.default_address = jsonObject.optInt("default_address");

     this.sign_building = jsonObject.optString("sign_building");
     this.name = jsonObject.optString("name");
     this.address_desc = jsonObject.optString("address_desc");

     this.city_name = jsonObject.optString("city_name");

     this.consignee = jsonObject.optString("consignee");

     this.tel = jsonObject.optString("tel");

     this.zipcode = jsonObject.optString("zipcode");


     this.country_name = jsonObject.optString("country_name");

     this.country = jsonObject.optString("country");

     this.city = jsonObject.optString("city");

     this.id = jsonObject.optInt("id");

     this.province_name = jsonObject.optString("province_name");

     this.district_name = jsonObject.optString("district_name");

     this.email = jsonObject.optString("email");

     this.address = jsonObject.optString("address");

     this.province = jsonObject.optString("province");

     this.district = jsonObject.optString("district");

     this.best_time = jsonObject.optString("best_time");

     this.mobile = jsonObject.optString("mobile");
     return ;
 }

 public JSONObject toJson() throws JSONException
 {
     JSONObject localItemObject = new JSONObject();
     JSONArray itemJSONArray = new JSONArray();
     localItemObject.put("default_address", default_address);
     localItemObject.put("sign_building", sign_building);
     localItemObject.put("name", name);
     localItemObject.put("address_desc", address_desc);
     localItemObject.put("city_name", city_name);
     localItemObject.put("consignee", consignee);
     localItemObject.put("tel", tel);
     localItemObject.put("zipcode", zipcode);
     localItemObject.put("country_name", country_name);
     localItemObject.put("country", country);
     localItemObject.put("city", city);
     localItemObject.put("id", id);
     localItemObject.put("province_name", province_name);
     localItemObject.put("district_name", district_name);
     localItemObject.put("email", email);
     localItemObject.put("address", address);
     localItemObject.put("province", province);
     localItemObject.put("district", district);
     localItemObject.put("best_time", best_time);
     localItemObject.put("mobile", mobile);
     return localItemObject;
 }

}
